#include "ChartsStorage.h"
namespace LightChart {
void ChartsStorage::add(Chart *chart) {
    std::map <Axis *, std::vector<Series *> > tmp_axes_series;
    for (Axis * axis : chart->get_axes())
        tmp_axes_series.insert(std::make_pair(axis, std::vector<Series *>()));
    insert(std::make_pair(chart, tmp_axes_series));
}
void ChartsStorage::remove(Chart *chart) {
    auto it = find(chart);
    delete (*it).first;
    erase(it);
}
ChartsStorage::~ChartsStorage() {
    for (std::pair<Chart *, std::map <Axis *, std::vector<Series *> > > pair : *this)
        delete pair.first;
}
}
